#ifndef DETECTOR_H_
#define DETECTOR_H_
#include "Driver_MCI.h" 

typedef struct {
	float STAValue;
	float LTAValue;
	float EMA06;
	float EMA02;
	float alphaSTA; 
	float alphaLTA;
  float alpha06Thr;
	float alpha02Thr;
	float oneMinusAlphaSTA;
	float oneMinusAlphaLTA;
	float oneMinusAlpha06Thr;
	float oneMinusAlpha02Thr;
	float cs;
	bool begFound;
} Detector;

void DetectorInit(Detector *d, float StaTime, float LtaTime, float freq);
float STALTA(Detector *d, short sample);
float LTA(Detector *d, short sample);
float STA(Detector *d, short sample);
float Threshold(Detector *d, short sample);
float CS(Detector *d, float stalta);
#endif
